﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dbPoll_Application.ViewModels.QuestionResponseViewModel>" %>
<%@ Import Namespace="dbPoll_Application.Helpers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	StartToResponse
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">var webURL = true;</script>
<script type="text/javascript" src="../../Scripts/PageControl.js"></script>
<script type="text/javascript" src="../../Scripts/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="../../Scripts/MessageListener.js"></script>

    <div class="pageHeadingContainer"><h2 class="pageHeading">Responding</h2></div>
    <div id="contentContainer">
    <p>Question Type: <%= Model.questionType %> </p>
    <% if (Model.questionType == "MCQ")
       { %>
        <p>No. <%=Model.questionNumber %> out of <%=Model.numberOfQuestions%> Questions: <%= Model.MCQuestion.question%></p>
        <p>Please select <%=Model.MCQuestion.allowedAnswers%> answer(s).</p>
    <% } else { %>
        <p>No. <%=Model.questionNumber %> out of <%=Model.numberOfQuestions%> Questions: <%= Model.SAQuestion.question%></p>
    <%}%>

        
    <div id="RespondContainer">
    <!-- using (Html.BeginForm("Index", "Report", FormMethod.Post)) -->
    <% using (Html.BeginForm("SaveResponse", "Respond", FormMethod.Post)) 
       { %>
       <%= Html.HiddenFor(model => model.questionType)%>
       <%= Html.HiddenFor(model => model.pollID, new{@id="pollID"})%>
       <%= Html.HiddenFor(model => model.questionNumber, new { @id = "questionNumber" })%>  
       <% if (Model.questionType == "MCQ")
          { %>   
          <%= Html.HiddenFor(model => model.MCQuestion.allowedAnswers)%>     
    <table class="questions">  
	    <tr class="questionCol">
	        <th align="right"><label for="MCQResponse">Select an option:</label></th>
	    </tr>
	    <tr>
	        <td><%= Html.ListBox("responses", Model.optionList, new { width = "10", @id = "selection" })%></td>
	    </tr> 
        <tr>
            <th class="questionCol" align="right"><label>Feedback:</label></th>
        </tr> 
        <tr>   
            <td><%= Html.TextAreaFor(model => model.feedback)%></td>
        </tr>
        </table>	   
	   <%}
          else
          { %>
        <table class="questions"> 
	        <tr>
	            <th  class="questionCol" align="right"><label for="SAResponse">Short Answer Response:</label></th>
	        </tr>
	        <tr>
	            <td><%= Html.TextAreaFor(model => model.SAQResponse, new { @id="shortAnswer"})%></td>
	        </tr>  
	        
	        <tr>
	            <th class="questionCol" align="right"><label>Feedback:</label></th>
	        </tr> 
	        <tr>   
	            <td><%= Html.TextAreaFor(model => model.feedback, new { @id = "feedback" })%></td>
	        </tr> 	      
            <% } %>
            <tr>
	            <td><input type="submit" id="RespondButton" value="Respond"/></td>
	        </tr>
	        	
        </table>
    <%= Html.ValidationSummary(true)%>
    <% } %>   
    </div>
    <div class="clear"></div>
        <div id="messageBoard">

        </div>
    </div>
</asp:Content>
